package com.sh.juc;

import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @Auther: sh
 * @Version 1.0
 * @Description:
 */
public class Main {
    public static void main(String[] args) throws InterruptedException {
        CopyOnWriteArrayList<String> objects = new CopyOnWriteArrayList<String>();
        for (int i = 0; i < 10000; i++) {
           new Thread(()->{
              objects.add(Thread.currentThread().getName());
           }).start();
        }
        Thread.sleep(1000);
        System.out.println(objects.size());
    }
}

